#include "headfiles.h"

using namespace std;

bool sortStack(MyStack<int> &stck) {
	MyStack<int> tmp;
	int val, max_val;
	size_t size = 0;
	while (stck.size() > size) {
		max_val = stck.top();
		stck.pop();
		while (stck.size() > size) {
			val = stck.top();
			stck.pop();
			if (val > max_val) {
				tmp.push(max_val);
				max_val = val;
			}
			else {
				tmp.push(val);
			}
		}
		stck.push(max_val);
		while (!tmp.empty()) {
			val = tmp.top();
			tmp.pop();
			stck.push(val);
		}
		++size;
	}
		
	return true;
}

